package eight_dead_queue.reject_info;

import com.rabbitmq.client.BuiltinExchangeType;
import com.rabbitmq.client.Channel;
import util.RabbitMqUtils;

/**
 * @BelongsProject: RabbitMQ
 * @BelongsPackage: eight_dead_queue
 * @Author: HUI
 * @CreateTime: 2022-04-14 08:56
 * @Description: 死信队列发送方
 */
public class Producer {


    private static final String NORMAL_EXCHANGE = "normal_exchange";

    public static void main(String[] argv) throws Exception {
        Channel channel = RabbitMqUtils.getChannel();

        channel.exchangeDeclare(NORMAL_EXCHANGE, BuiltinExchangeType.DIRECT);
        for (int i = 1; i < 11; i++) {
            String message = "info" + i;
            channel.basicPublish(NORMAL_EXCHANGE, "zhangsan", null, message.getBytes());
            System.out.println("生产者发送消息:" + message);

        }
    }

}
